home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_shs_bngate1.cog < prev    next >
Text File  |  1999-11-15  |  5KB  |  183 lines

  1.  # Jones 3D Cog Script
  2. #
  3. # SHS_BNgate.cog      Make Big Nave gate open/close.  
  4. #
  5. # [JWC, SXC]
  6. #
  7. # (C) 1999 LucasArts Entertainment Company LLC. All Rights Reserved
  8. #
  9. # ========================================================================================
  10.  
  11. symbols
  12.  
  13. message activated
  14. message    startup
  15. message callback
  16.  
  17. keyframe    inReach=in_activate_medium.key            local
  18.  
  19. sound        unlock=tem_monkeykey_unlock_c.wav         local
  20.  
  21. thing    gate           
  22. thing   keyhole       
  23. thing    player            local
  24. thing    keyCam
  25. thing    gateCam
  26. thing    c1_t1
  27. thing    c1_t2
  28. thing    key
  29. thing     indy
  30. thing     indy_t1
  31.  
  32. int        keyed=0            local      
  33. int        olkey=115        local        # old lady key inv. number 
  34. int        whichitem        local
  35. int        curcam            local
  36. int        keygrumble        local
  37. int        in_rotRate        local
  38.  
  39. cog        doortalkcog
  40.         
  41.  
  42. end
  43.  
  44. # ========================================================================================
  45.  
  46. code
  47.  
  48.  
  49. startup:
  50.    
  51.     player= GetLocalPlayerThing();
  52.     SetThingLight(gate, '0.2 0.2 0.2', 0.01, 0.01);
  53.     SetThingFlags(key, 0x80000);
  54.     in_rotRate = GetThingMaxRotVel(indy);     # remember Indy rate
  55.     return;
  56.  
  57. activated:
  58.    
  59.     # check for oldlady key    to open gate
  60.     if (GetSenderRef() == keyhole)
  61.     {    
  62.         if (keyed==1) return; 
  63.         
  64.         # check if inventory is being used...
  65.         whichItem = GetCurItem(player);
  66.         
  67.         # Prep for scene...
  68.         SetActorFlags(player, 0x200000);
  69.         StartCutScene(1);
  70.         StopThing(player);
  71.         DeselectWeapon(player); # stow any weapon or lighter
  72.         DeselectWeaponWait(player);
  73.         CopyPlayerHolsters(player, indy);    # make sure our actor has matching props
  74.         Sleep(0.1); # wait a beat
  75.            
  76.         # Cut to Indy opening lock
  77.         curCam = GetCurrentCamera();   
  78.         SetCameraLookInterp(2, 0); # no pan & tilt
  79.         SetCameraPosInterp(2, 0); # no dolly
  80.         SetCameraFocus(2, keyCam);
  81.         SetCameraSecondaryFocus(2, c1_t1);
  82.         Sleep(.1);
  83.         SetCurrentCamera(2);
  84.         SetCameraFOV(75, 0, 0);
  85.         
  86.         # Switch actor indy for player...
  87.         SetThingFlags(player, 0x80000);        # hide him
  88.         ClearThingFlags(indy, 0x80000);        # reveal our actor
  89.         
  90.         
  91.         if ((whichItem == olkey) && (keyed == 0))
  92.         {
  93.             # Look and reach, Indy
  94.             AISetLookThing(indy, keyhole);
  95.             PlayKey(indy, inReach, 4, 0x12, 0);            
  96.             
  97.             ChangeInv(player, olKey, -1);
  98.             
  99.             Sleep(.2);
  100.             ClearThingFlags(key, 0x80000);
  101.  
  102.             # play sound of key opening
  103.             PlaySoundLocal(unlock, 1.0, 0.0, 0x0, 0);
  104.             sleep(.5);
  105.              
  106.             # Pan over to gate
  107.             SetCameraLookInterp(2, 1); # pan & tilt
  108.             SetCameraPosInterp(2, 1); # dolly
  109.             SetCameraInterpSpeed(2, 2.0);
  110.             Sleep(0.01);
  111.             SetCameraFocus(2, gateCam);
  112.             SetCameraSecondaryFocus(2, c1_t2);
  113.             SetCameraFOV(65, 1, 2.0);
  114.             
  115.             in_rotRate = GetThingMaxRotVel(indy);     # remember Indy rate
  116.             SetThingMaxRotVel(indy, 35.0);
  117.             AISetLookThing(indy, indy_t1);
  118.             sleep(1);
  119.             
  120.             # open gate
  121.             MoveToFrame(gate, 1, 1.0);
  122.             WaitForStop(gate);
  123.             keyed=1; # plays only once
  124.              
  125.             # Indy notes success
  126.             SendMessageEx(doortalkcog, user1, player, 1, 4, 0);
  127.             while (global15 == 0)
  128.             {
  129.                 Sleep(0.01); # wait for line to finish
  130.             }
  131.         }
  132.         else
  133.         {                                
  134.             if (whichItem != 0)
  135.             {
  136.                 # Take care of wrong keys and items...
  137.                 PlayKey(indy, inReach, 4, 0x12, 0);    
  138.                 Sleep(0.3);
  139.                 SendMessageEx(doortalkcog, user0, indy, olKey, whichItem, 0);
  140.             }
  141.             else
  142.             {
  143.                 if (keygrumble == 0)
  144.                 {
  145.                     # Note need for key 1st time thru...
  146.                     SendMessageEx(doortalkcog, user4, indy, 1, 3, 0);
  147.                     keygrumble = 1;
  148.                 }
  149.                 else
  150.                 {
  151.                     # General "door is locked" grmubling thereafter...
  152.                     SendMessageEx(doortalkcog, user4, indy, 0, 0, 0);
  153.                 }
  154.             
  155.             }
  156.             
  157.             while (global15 == 0)
  158.             {
  159.                 Sleep(0.01); # wait for line to finish
  160.             }
  161.         }
  162.         
  163.         Sleep(0.3);
  164.         SetThingMaxRotVel(indy, in_rotRate);# reset indy rotate velocity
  165.         CopyOrientAndPos(indy, player); # move player to actor's spot
  166.         SetCameraPosition(1, GetThingPos(keyCam)); # prep to swing back to follow-cam
  167.         SetCameraLookInterp(2, 0); # kill pan & tilt mode
  168.         SetCameraPosInterp(2, 0); # kill dolly mode
  169.         sleep(.01);
  170.         ResetCameraFOV(0, 0.0);
  171.         SetCurrentCamera(1);  
  172.         SetThingFlags(indy, 0x80000);
  173.         ClearThingFlags(player, 0x80000);
  174.         ClearActorFlags(player, 0x200000);
  175.         EndCutscene();
  176.     
  177.      }                                                                        
  178.     return;    
  179.  
  180. end
  181.  
  182.  
  183.